package com.example.cpoopc.helloretrofit.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.SpannableStringBuilder;

/**
 * 回复信息
 * 
 * <br>Created 2014-8-21 下午3:56:19
 * @version  
 * @author   chenpeng		
 *
 * @see
 */
public class ReplyInfo implements Parcelable{
    public long rid;// 评论rid
    public String content;// 评论内容
    public SpannableStringBuilder contentSpan;// 
    public long post_time;// 发布评论时间戳
    public long floor_id;// 楼层号
    public long uid;// 评论者的uid
    public long oid;// 帖子id
    public UserInfo user;// 评论者信息 如果为空，可以通过 uid 获取评论者信息
    public UserInfo to_user;// 被评论者信息
    public long to_floor_id;// 回复评论时，原评论的floor_id
//    public ReplyInfoList replyList;
    
    
    
    public ReplyInfo() {
        super();
    }


    public ReplyInfo(long rid, String content, long post_time, long floor_id, long uid, long oid,
                     UserInfo user, UserInfo to_user, long to_floor_id) {
        super();
        this.rid = rid;
        this.content = content; 
        this.post_time = post_time;
        this.floor_id = floor_id;
        this.uid = uid;
        this.oid = oid;
        this.user = user;
        this.to_user = to_user;
        this.to_floor_id = to_floor_id;
        if(to_floor_id == 0){
        	this.to_user = null;
        }
    }



    private ReplyInfo(Parcel source){
        rid = source.readLong();// 评论rid
        content = source.readString();// 评论内容
        post_time = source.readLong();// 发布评论时间戳
        floor_id = source.readLong();// 楼层号
        uid = source.readLong();// 评论者的uid
        oid = source.readLong();// 被评论对象oid  
        user = UserInfo.CREATOR.createFromParcel(source);// 评论者信息 如果为空，可以通过 uid 获取评论者信息
        to_floor_id = source.readLong();// 回复评论时，原评论的floor_id
//        replyList = ReplyInfoList.CREATOR.createFromParcel(source);
        
    }
    
    public static final Creator<ReplyInfo> CREATOR = new Creator<ReplyInfo>() {
        
        @Override
        public ReplyInfo[] newArray(int size) {
            // TODO Auto-generated method stub
            return new ReplyInfo[size];
        }
        
        @Override
        public ReplyInfo createFromParcel(Parcel source) {
            // TODO Auto-generated method stub
            return new ReplyInfo(source);
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }



    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(rid);
        dest.writeString(content);
        dest.writeLong(post_time);
        dest.writeLong(floor_id);
        dest.writeLong(uid);
        dest.writeLong(oid);
        user.writeToParcel(dest, flags);
        dest.writeLong(to_floor_id);
//        replyList.writeToParcel(dest, flags);
    }
    
    
    
}
